package eric.mpab.domain;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import eric.mpab.model.AccountSymbol;
import eric.mpab.model.AccountType;

@Entity @Table(name="account")
public class AccountDO {
	@Id @GeneratedValue(strategy=GenerationType.AUTO)
	private Long id;
	@Enumerated(EnumType.STRING)
	private AccountType type;
	@Enumerated(EnumType.STRING)
	private AccountSymbol symbol;
	@Basic
	private String name;
	@Basic
	private String description;
	@ManyToOne @JoinColumn(name="parent_id")
	private AccountDO parent;
	@OneToMany(mappedBy="parent")
	private List<AccountDO> children = new ArrayList<AccountDO>();
	@Column(name="idx_id")
	private String indexId;

	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public AccountType getType() {
		return type;
	}
	public void setType(AccountType type) {
		this.type = type;
	}
	public AccountSymbol getSymbol() {
		return symbol;
	}
	public void setSymbol(AccountSymbol symbol) {
		this.symbol = symbol;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public AccountDO getParent() {
		return parent;
	}
	public void setParent(AccountDO parent) {
		this.parent = parent;
	}
	public List<AccountDO> getChildren() {
		return children;
	}
	public void setChildren(List<AccountDO> children) {
		this.children = children;
	}
	public String getIndexId() {
		return indexId;
	}
	public void setIndexId(String indexId) {
		this.indexId = indexId;
	}
}
